from app.web.comm.data_format import data_formatting
#参数1=数据源
#参数2=发送接口的数据
def test_datalist(datas,updatas):
     list1 = ['client_id','seller_name','taxpayer_num','seller_bank_account','seller_bank_name','seller_address','seller_tel',
           'region_code','reviewer','payee','areas','store_id','drawer'
           ]
     list2 = ['id','name','tax_code','sell_bank_account','sell_bank_name','sell_address','sell_phone','region_code','reviewer',
           'payee','areas','store_id','drawer']
     data = {}
     for i in range(0,len(list1)-1):
         #print(i)
         k1 = list1[i]
         k2 = list2[i]
         data[k1] = datas[k2]
     # data['client_id'] = datas['id']
     # data['client_name'] = datas['name']
     # data['seller_bank_account'] = datas['sell_bank_account']
     # data['seller_bank_name'] = datas['sell_bank_name']
     # data['seller_address'] = datas['sell_address']
     # data['seller_phone'] = datas['sell_phone']
     # data['region_code'] = datas['region_code']
     # data['reviewer'] = datas['reviewer']
     # data['payee'] = datas['payee']
     # data['areas'] = datas['areas']
     #print(data,'\n')
     for k in data.keys():
         if k in updatas:
            #print(k)
            updatas[k] = data[k]
            #updatas[k1] = data[k2]
     #a = data_formatting(updatas)
     #print('请求data：%s'%a)


def test_datalist2(datas, updatas):
    list1 = ['client_id', 'seller_name', 'taxpayer_num', 'seller_bank_account', 'seller_bank_name', 'seller_address',
             'seller_tel',
             'region_code', 'reviewer', 'payee', 'areas', 'store_id', 'drawer'
             ]
    list2 = ['client_id', 'name', 'tax_code', 'sell_bank_account', 'sell_bank_name', 'sell_address', 'sell_phone',
             'region_code', 'reviewer',
             'payee', 'areas', 'store_id', 'drawer']
    data = {}
    for i in range(0, len(list1) - 1):
        # print(i)
        k1 = list1[i]
        k2 = list2[i]
        data[k1] = datas[k2]

    for k in data.keys():
        if k in updatas:
            # print(k)
            updatas[k] = data[k]
            # updatas[k1] = data[k2]
            # a = data_formatting(updatas)
            # print('请求data：%s'%a)


def test_projectlist(datas, updatas):
    list1 = ['id', 'name', 'tax_code', 'tax_rate','is_default', 'firm_goods_no', 'firm_goods_name', 'models',
             'unit','special_invoice_kind']# 'price',
    list2 = ['id', 'name', 'tax_code', 'tax_rate','is_default', 'firm_goods_no', 'firm_goods_name', 'models',
             'unit', 'special_invoice_kind']#'per_price',
    data = {}
    for i in range(0, len(list1) - 1):
        # print(i)
        k1 = list1[i]
        k2 = list2[i]
        data[k1] = datas[k2]

    for k in data.keys():
        if k in updatas:
            # print(k)
            updatas[k] = data[k]
            # updatas[k1] = data[k2]
    #a = data_formatting(updatas)
    #print('开票项data：%s'%a)

def test_storelists(datas, updatas):
    list1=["id","tax_disk_type","sub_no","taxNumBW","reviewer","payee","provinceArr","address","tax_num"]
    list2=["id","tax_disk_type","sub_no","tax_num","reviewer","payee","region_code","address","tax_num"]
    data = {}
    for i in range(0, len(list1)):
        #print(i)
        k1 = list1[i]
        k2 = list2[i]
        data[k1] = datas[k2]
    for k in data.keys():
        if k in updatas:
            #print(k)
            updatas[k] = data[k]
    # a = data_formatting(updatas)
    # print('开票项data：%s'%a)



if __name__ == '__main__':
     datas = {'id': '8156', 'name': 'DJY小程序注册商户', 'tax_code': '73140926MA0HAHBH1D42', 'sell_bank_account': '128568856698',
              'sell_bank_name': '测试银行G', 'sell_address': '西藏林芝市巴宜区八一镇林芝市生物科技产业园202-3', 'sell_phone': '0755-8142354',
              'region_code': '340202', 'reviewer': '', 'payee': '', 'invoice_type': ['0', '1', '2'], 'areas': '安徽省芜湖市镜湖区', 'drawer': 'yang', 'store_id': 6065}
     updatas = {
            "buyer_title_type": 1,
            "buyer_title": "在线人工个人开票测试",
            "buyer_taxcode": "",
            "buyer_email": "",
            "buyer_address": "",
            "buyer_phone": "",
            "buyer_bank_name": "",
            "buyer_bank_account": "",
            "seller_name": "",
            "taxpayer_num": "",
            "seller_address": "",
            "seller_tel": "",
            "seller_bank_name": "",
            "seller_bank_account": "",
            "goods_info": "[{\"name\":\"娱乐服务\",\"models\":\"\",\"unit\":\"\",\"total\":1.5,\"price\":1.41509434,\"price_with_tax\":1.5,\"total_price\":\"2.12\","
                          "\"total_price_with_tax\":\"2.25\",\"tax_rate\":\"6%\",\"tax_amount\":\"0.13\",\"id\":\"2615\",\"tax_code\":\"3070302000000000000\","
                          "\"firm_goods_name\":\"娱乐服务\",\"firm_goods_no\":\"3070302000000000000\",\"per_price\":\"\",\"special_invoice_kind\":\"\",\"_key\":\"I1f8sycRLGUGW9qT\"}]",
            "total_tax": "0.13",
            "total_price": "2.12",
            "total_price_with_tax": "2.25",
            "total_rmb": "贰圆贰角伍分",
            "remark": "",
            "drawer": "",
            "payee": "",
            "reviewer": "",
            "amount": "2.25",
            "extra": ""
            }
     test_datalist(datas,updatas)
     print(datas)








